package com.jrh.dal.user.like;

import java.util.List;
import java.util.Map;

import com.jrh.dal.BaseDao;
import com.jrh.domain.common.Page;
import com.jrh.domain.entity.Atlas;

/**
 * 用户喜欢美图集DAO
 * 
 * @author jasen.hsu.cn@gmail.com 2012-8-7 下午8:03:44
 */
public class UserLikeAtlasDao extends BaseDao<Atlas> implements UserLikeReadDao<Atlas> {

    public UserLikeAtlasDao(){
        this.namespace = "jrh.single.atlas";
    }

    @Override
    public Page<Atlas> listUserLikeItems(Long userId, Integer start, Integer pageSize, Long style, Long category) {
        Map<String, Object> map = this.getPageMap(start, pageSize);
        map.put("style", style);
        map.put("category", category);
        map.put("userId", userId);
        @SuppressWarnings("unchecked")
        List<Atlas> atlases = (List<Atlas>) sqlMapClientTemplate.queryForList(namespace + "." + "listUserlike", map);
        Integer count = (Integer) sqlMapClientTemplate.queryForObject(namespace + "." + "listUserlike_count", map);
        return new Page<Atlas>(atlases, start, pageSize, count);
    }

}
